<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>填写与核对订单</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="../css/order.ordersubmit.css">
    <script type="application/javascript" src="../js/jquery-3.3.1.js"></script>
    <script type="application/javascript" src="../js/bootstrap.min.js"></script>
    <script type="application/javascript" src="../layui/layui.js"></script>
    <script src="/js/vue2.min.js"></script>
    <script src="/js/axios.min.js"></script>

</head>
<body style="position: static">
    <div id="app" class="bgGray">
        <div data-v-95ac8d30="" class="header3">
            <div data-v-95ac8d30="" class="layout clear">
                <div data-v-95ac8d30="" class="left logo">
                    <a data-v-95ac8d30="" href="index.html">
                        <img data-v-95ac8d30="" src="">
                    </a>
                </div>
                <div data-v-95ac8d30="" class="header3Nav right">|<a data-v-95ac8d30="" href="../mymain/mymain.html">我的订单</a>|<a data-v-95ac8d30="" href="helpCenter.html">帮助中心</a>|<a data-v-95ac8d30="" href="javascript:void">退出</a></div> <div data-v-95ac8d30="" class="header3User right"><i data-v-95ac8d30="" class="iconfont icon-phone"></i><span data-v-95ac8d30="" class="sp1">400-919-8000</span><span data-v-95ac8d30="" class="sp2">欢迎您，</span><span data-v-95ac8d30="" class="sp3"></span></div></div></div>




        <div class="checkOrderTit">
            <div class="layout">
                <div class="checkOrderTitCom">
                    <div class="checkOrderTitComT">
                        <div class="td1 bgRed"></div>
                        <div class="td2 bgRed">1</div>
                        <div class="td3 bgRed"></div>
                        <div class="td2 bgRed">2</div>
                        <div class="td3 bgGray1"></div>
                        <div class="td2 bgGray1">3</div>
                        <div class="td1 bgGray1"></div>
                    </div>
                    <div class="checkOrderTitComB">
                        <div class="bd1 colorRed">选择车辆</div>
                        <div class="bd2 colorRed">填写和核对订单</div>
                        <div class="bd1 colorGray">提交成功</div>
                    </div>
                </div>
            </div>
        </div>

        <div class="orderMsg clear">

            <div class="orderMsgs">
            <div class="orderMsgL left">
                <img :src="infos.picture">
                <p>type|sitnum座</p>

            </div>
            <div class="orderMsgR left">
                <div class="carTitle">
                    <span class="carTitle1 left">name</span>
                </div>

                <div class="selCarMsg">
                    <div class="selCarMsgCom">
                        <div class="MsgTit">取车</div>
                        <div class="Msg">取车地址：</div>
                    </div>

                    <div class="selCarMsgCom">
                        <div class="MsgTit">还车</div>
                        <div class="Msg">还车地址：</div>
                    </div>
                </div>
            </div>
                <div class="costCom right">
                    <h3>费用明细</h3>
                    <div class="item">
                        <span class="left" >基本租金</span>
                        <span class="right">元</span>
                    </div>
                    <div class="item">
                        <span class="left" >手续费（35元/单）</span>
                        <span class="right">35元</span>
                    </div>
                    <div class="item">
                        <span class="left" >基本保障服务</span>
                        <span class="right">50元</span>
                    </div>
                    <div class="payMony">
                    <label class="right">应付金额&nbsp;
                    <span id="total">{{current()}}</span></label>
                    </div>
                    <button class="buttons right" id="butt" @click="addOrder" >
                        提交订单
                    </button>
                </div>
        </div>
        </div>
    </div>
    <script type="text/javascript">
            // var id = window.location.search;
            var id = '?getid=7&backid=10&cid=6';
            var vm = new Vue({
            el:'.orderMsgs',
            data:{
            infos:'',
            getcitys : '',
            backcitys: ''
        },

            methods: {
                current: function () {
                    var total = 0;
                    var money = 85;
                    total = this.infos.price + money;
                    return total;
                },
                addOrder: function () {
                    alert(111);
                    //1写订单 ，发送ajax请求

                    axios.get("addOrder" + id)
                        .then(function (res) {
                            console.log(res);
                            if (res.data == "fail") {//发现用户未登录，先去登录
                                window.location.href = "loginView";
                            }
                            if (res.data == "success") {//用户已登录，则去写订单并成功
                                //2写成功后，显示我的订单
                                window.location.href = "orders"
                            }
                        })
                        .catch(function (error) {
                            console.log(error);
                        });
                }
            }
        });
    </script>

    <script>
        window.onload = function (){
            console.log(id);
            axios.get("carorder"+id)
                .then(function (res){
                    console.log(res);
                    vm.getcitys = res.data.getcity;
                    vm.backcitys=res.data.backcity;
                    vm.infos=res.data.xcCarinfo;
                })
                .catch(function(error){
                    console.log(error);
                })


        }
    </script>
</body>
</html>